<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>AVISource / OpenDMLSource / AVIFileSource / WAVSource Avisynth Filter</title>
   <link rel="stylesheet" type="text/css" href="../../avisynth.css">
</head>
<body>
<h2>&nbsp;&nbsp;&nbsp; <a NAME="AVISource"></a>AVISource / OpenDMLSource / AVIFileSource / WAVSource</h2>
<p><code>AVISource </code>(<var>string filename [, ...], bool "audio" = true, string
"pixel_type" = &quot;FULL&quot;, [string fourCC]</var>)<br>
  <code>OpenDMLSource </code>(<var>string filename [, ...], bool &quot;audio&quot; = true, string &quot;pixel_type&quot; =
&quot;FULL&quot;,
[string fourCC]</var>)<br>
  <code>AVIFileSource </code>(<var>string filename [, ...], bool &quot;audio&quot; = true, string &quot;pixel_type&quot; =
&quot;FULL&quot;,
[string fourCC]</var>)<br>
  <code>WAVSource </code>(<var>string filename [, ...]</var>)
<p><code>AVISource</code>  takes as argument one or more file name in quotes,
and reads in the file(s) using either the Video-for-Windows "AVIFile" interface,
or AviSynth's built-in OpenDML code (taken from VirtualDub). This filter
can read any file for which there's an AVIFile handler. This includes not
only AVI files but also WAV files, AVS (AviSynth script) files, and VDR
(VirtualDub frameserver) files. If you give multiples filenames as arguments,
the clips will be spliced together with <code><a href="splice.htm">UnalignedSplice</a></code>. The <var>bool</var>
argument is optional and defaults to <code>true</code>.
<p>The <code>AVISource</code> filter examines the file to determine its type
and passes it to either the AVIFile handler or the OpenDML handler as appropriate.
In case you have trouble with one or the other handler, you can also use
the <code>OpenDMLSource</code> and <code>AVIFileSource</code> filters, which force
the use of one or the other handler. Either handler can read ordinary (&lt;
2GB) AVI files, but only the OpenDML handler can read larger AVI files,
and only the AVIFile handler can read other file types like WAV, VDR and
AVS. There is built-in support for ACM (Audio Compression Manager) audio (e.g. mp3-AVIs).
<p>
  <code>WAVSource</code> can be used to open a WAV file, or the audio stream from an AVI
  file. This can be used, for example, if your video stream is damaged or its compression method is not supported on your system.</p>
<p>The <var>pixel_type</var> parameter (default &quot;YV12&quot; allows you to choose the output format
of the decompressor. Valid values are "YV12", "YV411", "YV16", "YV24", "YUY2", "Y8", "RGB32" and
&quot;RGB24&quot;. If omitted, AviSynth will use the first format supported by the decompressor
(in the following order: YV12, YV411, YV16, YV24, YUY2, Y8, RGB32 and RGB24). This parameter has
no effect if the video is in an uncompressed format, because no decompressor will be used in that
case. To put it in different words: if you don't specify something it will try to output the AVI as
YV12, if that isn't possible it tries YV411 and if that isn't possible it tries YV16, etc ...
<p>The <var>pixel_type</var> parameter allows you to choose the output format
of the decompressor. Valid values are "YV24", "YV16", "YV12", "YV411", "YUY2",
"RGB32", "RGB24", "Y8", "AUTO" and "FULL" (default value). If omitted or set
to "FULL", AviSynth will use the first format supported by the decompressor
(in the following order: YV24, YV16, YV12, YV411, YUY2, RGB32, RGB24 and Y8).
If set to "AUTO", AviSynth will use the old ordering: YV12, YUY2, RGB32, RGB24
and Y8. This parameter has no effect if the video is in an uncompressed
format, because no decompressor will be used in that case. To put it in
different words: if you don't specify something it will try to output the AVI
as YV24, if that isn't possible it tries YV16 and if that isn't possible it
tries YV12, etc ...
<p>Sometimes the colors will be distorted when loading a DivX clip in AviSynth
v2.5 (the chroma channels U and V are swapped), due to a bug in DivX (5.02
and older). You can use <a href="swap.htm"><code>SwapUV</code></a> to correct it.
<p>From <em>v2.53</em> <code>AVISource</code> can also open DV type 1 video input (only
video, not audio).
<p>From <em>v2.55</em>, an option <var> fourCC</var> is added. FourCC, is a FOUR Character Code in the
beginning of media file, mostly associated with avi, that tells what codec your system should use for
decoding the file. You can use this to force AviSource to open the avi file using a different codec.
A list of FOURCCs can be found <a href="http://www.fourcc.org/index.php?http%3A//www.fourcc.org/codecs.php"><cite>here</cite></a>.
By default, the fourCC of the avi is used.
<p>Some MJPEG/DV codecs do not give correct CCIR 601 compliant output when
using <code>AVISource</code>. The problem could arise if the input and output colorformat
of the codec are different. For example if the input colorformat is YUY2,
while the output colorformat is RGB, or vice versa. There are two ways
to resolve it:
<p>1) Force the same output as the input colorformat. Thus for example
(if the input is RGB):
<pre>AVISource(&quot;file.avi&quot;, pixel_type=&quot;RGB32&quot;)</pre>
<p>2) Correct it with the filter <a href="coloryuv.htm">ColorYUV</a>:
<pre>AVISource(&quot;file.avi&quot;).ColorYUV(levels=&quot;PC-&gt;TV&quot;)</pre>
<p>Some reference threads:
<br>
  <cite><a href="http://forum.doom9.org/showthread.php?s=&postid=330657">MJPEG
codecs</a></cite>
<br>
  <cite><a href="http://forum.doom9.org/showthread.php?s=&threadid=58110">DV
codecs</a></cite>
<p><b>Examples:</b></p>

<pre># C programmers note: backslashes are not doubled; forward slashes work too
AVISource(&quot;d:\capture.avi&quot;)
AVISource(&quot;c:/capture/00.avi&quot;)
WAVSource(&quot;f:\soundtrack.wav&quot;)
WAVSource(&quot;f:/soundtrack.wav&quot;)

# the following is the same as AVISource(&quot;cap1.avi&quot;) + AVISource(&quot;cap2.avi&quot;):
AVISource(&quot;cap1.avi&quot;, &quot;cap2.avi&quot;)

# disables audio and request RGB32 decompression
AVISource(&quot;cap.avi&quot;, false, &quot;RGB32&quot;)

# opens a DV using the Canopus DV Codec
AviSource(&quot;cap.avi&quot;, false, fourCC=&quot;CDVC&quot;)

# opens an avi (for example DivX3) using the XviD Codec
AviSource(&quot;cap.avi&quot;, false, fourCC=&quot;XVID&quot;)

# splicing two clips where one of them contains no audio.
# when splicing the clips must be compatible (have the same video and audio properties):
A = AviSource(&quot;FileA.avi&quot;)
B = AviSource(&quot;FileB.avi&quot;) # No audio stream
A ++ AudioDub(B, BlankClip(A))</pre>
<p>Some compression formats impose a limit to the number of AviSource() calls
that can be placed in a script. Some people have experienced this limit with
fewer than 50 AviSource() statements. See <cite><a href="http://forum.doom9.org/showthread.php?t=131687">discussion</a></cite>.</p>
<p><b>Changes:</b></p>
<table border="1">
  <tbody>
    <tr>
      <td>v2.60</td>
      <td>Added new color formats, &quot;AUTO&quot; and &quot;FULL&quot;.</td>
    </tr>
    <tr>
      <td>v2.55</td>
      <td>Added fourCC option.</td>
    </tr>
  </tbody>
</table>
<p><kbd>$Date: 2012/05/03 07:32:20 $</kbd></p>
<form><input TYPE="Button" VALUE="Back"
onClick="history.go(-1)"></form>
</body>
</html>
